<extend name="Public/base"/>

<block name="body">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript" src="__STATIC__/UploadImages.js"></script>
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>

    <div class="tab-wrap">
        <ul class="tab-nav nav">
            <li data-tab="tab1" class="current"><a>基 础</a></li>
        </ul>
        <div class="tab-content">
            <form action="{:U('update')}" method="post" class="form-horizontal" enctype="multipart/form-data">
                <input type="text" class="hidden" name="id" value="{$info['id']}">
                <div class="form-item">
                    <label class="item-label">视频标题</label>
                    <div class="controls">
                        <input type="text" class="text input-large" name="title" value="{$info['title']}">
                    </div>
                </div>
                <div class="form-item cf">
                    <label class="item-label">封面<span class="check-tips"></span></label>
                    <div class="controls">
                        <div class="controls">
                            <input type="file" id="upload_picture_cover_id">
                            <input type="hidden" name="cover_id" id="cover_id_cover_id" value="{$info['cover_id']}"/>
                            <div class="upload-img-box">
                                <notempty name="info['cover_id']">
                                    <div class="upload-pre-item"><img src="{$info['cover_id']|get_cover='path'}"/></div>
                                </notempty>
                            </div>
                        </div>
                        <script type="text/javascript">
                            //上传图片
                            /* 初始化上传插件 */
                            $("#upload_picture_cover_id").uploadify({
                                "height"          : 30,
                                "swf"             : "__STATIC__/uploadify/uploadify.swf",
                                "fileObjName"     : "download",
                                "buttonText"      : "上传图片",
                                "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                                "width"           : 120,
                                'removeTimeout'	  : 1,
                                'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
                                "onUploadSuccess" : uploadPicturecover_id,
                                'onFallback' : function() {
                                    alert('未检测到兼容版本的Flash.');
                                }
                            });
                            function uploadPicturecover_id(file, data){
                                var data = $.parseJSON(data);
                                var src = '';
                                if(data.status){
                                    $("#cover_id_cover_id").val(data.id);
                                    src = data.url || '__ROOT__' + data.path
                                    $("#cover_id_cover_id").parent().find('.upload-img-box').html(
                                            '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                                    );
                                } else {
                                    updateAlert(data.info);
                                    setTimeout(function(){
                                        $('#top-alert').find('button').click();
                                        $(that).removeClass('disabled').prop('disabled',false);
                                    },1500);
                                }
                            }
                        </script>

                    </div>
                </div>
                <div class="form-item">
                    <label class="item-label">修改视频文件</label>
                    <div class="controls">
                        <input type="text" class="text input-large" name="url" value="{$info['url']}">
                    </div>
                </div>
                <div class="form-item">
                    <label class="item-label">浏览</label>
                    <div class="controls">
                        <video id="video" controls src="{$info['url']}">
                        </video>
                    </div>
                </div>
                <div class="form-item">
                    <label class="item-label">视频描述</label>
                    <div class="controls">
                        <textarea class="text input-large" name="detail">{$info['detail']}</textarea>
                        {:hook('adminArticleEdit', array('name'=>detail,'value'=>detail))}
                    </div>
                </div>
                <div class="form-item">
                    <label class="item-label">是否展示</label>
                    <div class="controls">
                        <label class="radio"><input type="radio" name="status" value="1"
                            <eq name="info['status']" value="1">checked="checked"</eq>
                            >是</label>
                        <label class="radio"><input type="radio" name="status" value="0"
                            <eq name="info['status']" value="0">checked="checked"</eq>
                            >否</label>
                    </div>
                </div>
                <div class="form-item">
                    <button class="btn submit-btn" id="submit" type="submit" target-form="form-horizontal">确 定</button>
                    <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
                </div>
            </form>
        </div>
    </div>
</block>
